package com.gym.controller;

import com.gym.client.GoodsClient;
import com.gym.pojo.Cashier;
import com.gym.pojo.Goods;
import com.gym.pojo.Purchase;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class GoodsController {
    @Resource
    private GoodsClient client;
    @RequestMapping("/selectcp")
    public Map<String, Object> selectcp(String goodsname,int page,int limit){
        return client.selectcp(goodsname,page,limit);
    }
    @RequestMapping("insertsm")
    public boolean insertsm(Purchase purchase,int totalstock){
        return client.insertsm(purchase,totalstock);
    }
    @RequestMapping("selectzj")
    public List<Goods> selectzj(){
        return client.selectzj();
    }
    @RequestMapping("insertzj")
    public boolean insertzj(Cashier cashier){
        return client.insertzj(cashier);
    }
    @RequestMapping ("/deletezj")
    public boolean deletezj(int cashierId){
        return client.deletezj(cashierId);
    }
    @RequestMapping("selectsm")
    public Map<String,Object> selectsm(Integer cashierId,int page,int limit){
        return client.selectsm(cashierId,page,limit);
    }
    @RequestMapping("/insertjh")
    public boolean insertjh(Goods goods){
        return client.insertjh(goods);
    }
    @RequestMapping("updatejj")
    public boolean updatejj(int totalstock, int goodsId, int goodsamount){
        return client.updatejj(totalstock,goodsId,goodsamount);
    }
    @RequestMapping("selectysp")
    public boolean selectysp(String goodsname){
        return client.selectysp(goodsname);
    }
    @RequestMapping("selectzkc")
    public boolean selectzkc(int goodsId,int totalstock){
        return client.selectzkc(goodsId,totalstock);
    }
    @RequestMapping("selectsl")
    public boolean selectsl(int goodsId,int goodsamount){
        return client.selectsl(goodsId,goodsamount);
    }
    @RequestMapping("deletesc")
    public boolean deletesc(int goodsId){
        return client.deletesc(goodsId);
    }
}
